<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>在线点餐系统管理平台</title>
<link rel="stylesheet" href="${pageContext.request.contextPath }/admin/css/reset.css" type="text/css" media="screen" />
<link rel="stylesheet" href="${pageContext.request.contextPath }/admin/css/style.css" type="text/css" media="screen" />
<link rel="stylesheet" href="${pageContext.request.contextPath }/admin/css/invalid.css" type="text/css" media="screen" />
<script type="text/javascript" src="${pageContext.request.contextPath }/admin/scripts/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath }/admin/scripts/simpla.jquery.configuration.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath }/admin/scripts/facebox.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath }/admin/scripts/jquery.wysiwyg.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath }/admin/scripts/jquery.datePicker.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath }/admin/scripts/jquery.date.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath }/js/common.js"></script>
<script type='text/javascript' src='${pageContext.request.contextPath }/dwr/interface/userMng.js'></script>
<script type='text/javascript' src='${pageContext.request.contextPath }/dwr/engine.js'></script>
<script type="text/javascript">
function chkInput(obj){
	if(obj.value.Trim()==""){
		document.getElementById(obj.id+"Span").className="input-notification error png_bg";
		document.getElementById(obj.id+"Span").innerText="请填写";
	}else{
		document.getElementById(obj.id+"Span").className="input-notification success png_bg";
		document.getElementById(obj.id+"Span").innerText="";
	}
}
function chkPwd(){
	var pwd = document.getElementById("pwd");
	var repwd = document.getElementById("repwd");
	if(pwd.value!=repwd.value){
		document.getElementById("repwdSpan").className="input-notification error png_bg";
		document.getElementById("repwdSpan").innerText="两次密码不一样,请重新输入";
	}else{
		document.getElementById("repwdSpan").className="input-notification success png_bg";
		document.getElementById("repwdSpan").innerText="";
	}
}
function chkLogin(obj){
	if(obj.value.Trim()==""){
		document.getElementById(obj.id+"Span").className="input-notification error png_bg";
		document.getElementById(obj.id+"Span").innerText="请填写";
	}else{
		userMng.isExistLogin(obj.value, function(data){
			if(data){
				document.getElementById(obj.id+"Span").className="input-notification error png_bg";
				document.getElementById(obj.id+"Span").innerText="该名称已存在，请更换";
			}else{
				document.getElementById(obj.id+"Span").className="input-notification success png_bg";
				document.getElementById(obj.id+"Span").innerText="";
			}
		});
	}
}
</script>
</head>
<body>
  <%-- 加载左边菜单 --%>
  <s:include value="../main/left.jsp?mid=m41"></s:include>
  
	<div class="clear"></div>
  <div id="main-content">
    <!-- Box Content -->
    <div class="content-box">
    	<!-- Box Header -->
      <div class="content-box-header">
        <h3>添加人员信息</h3>
        <div class="clear"></div>
      </div>
      <!-- End Box Header -->
      
      <!-- 信息提示 -->
      <s:if test="#request.fieldErrors.size>0">
      <div class="notification error png_bg"><a href="#" class="close"><img src="${pageContext.request.contextPath }/admin/images/icons/cross_grey_small.png" title="关闭" alt="关闭" /></a>
      	<div><s:fielderror/></div>
      </div>
      </s:if>
			<s:if test="#request.actionMessages.size>0">
			<div class="notification error png_bg"><a href="#" class="close"><img src="${pageContext.request.contextPath }/admin/images/icons/cross_grey_small.png" title="关闭" alt="关闭" /></a>
				<div><s:actionmessage/></div>
			</div>
			</s:if>
			<!-- 信息提示结束 -->
			
			<!-- Table Content -->
      <div class="tab-content">
        <s:form action="userManager!add" method="post" namespace="/admin">
        	<fieldset>
          <p>
          	<label>姓名</label>
            <s:textfield cssClass="text-input small-input" id="userName" name="user.username" onblur="chkInput(this)"/>
            <span id="userNameSpan"></span>
            <br />
          	<small>必填</small>
          </p>
          
          <p>
            <label>登陆账号</label>
            <s:textfield cssClass="text-input small-input" id="login" name="user.login" onblur="chkLogin(this)"/>
            <span id="loginSpan"></span>
            <br />
            <small>用户后台登陆账号</small>
          </p>
            
          <p>
           <label>登陆密码</label>
           <s:password cssClass="text-input small-input" id="pwd" name="user.pwd" onblur="chkInput(this)"/>
           <span id="pwdSpan"></span>
           <br />
           <small>必填</small>
          </p>
            
          <p>
           <label>重复密码</label>
           <input class="text-input small-input" type="password" id="repwd" name="repwd" onblur="chkPwd();"/>
           <span id="repwdSpan"></span>
           <br />
           <small>两次密码必须一致</small>
          </p>
          
          <p>
            <label>角色</label>
            <s:select name="user.sysRoleinfo.id" list="roles" cssClass="small-input" listKey="id" listValue="name" headerKey="0"/>
          </p>
            
          <p>
            <label>所属公司</label>
            <s:select name="user.companyInfo.id" list="coms" cssClass="small-input" listKey="id" listValue="name" headerKey="0"/>
          </p>
          
          <p>
            <label>注册状态</label>
            <s:select name="user.state" list="#{1:'正  常',2:'停  用'}" cssClass="small-input" listKey="key" listValue="value"  headerKey="0"/>
          </p>
          
          <p><input class="button" type="submit" value="提  交" /></p>
          </fieldset>
        </s:form>
      </div>
      <!-- End Table Content -->
     </div>
     <!-- End Box Content -->
  
	<div class="clear"></div>
	<%-- 加载底部 --%>
	<s:include value="../main/footer.jsp"></s:include>
</body>
</html>

